package com.scb.api.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Repository;

import com.scb.api.dao.UserDao;
import com.scb.api.entity.User;
import com.scb.util.CustomHibernateDaoSupport;

@Repository("UserDao")
public class UserDaoImpl extends CustomHibernateDaoSupport implements UserDao {

	@SuppressWarnings("unchecked")
	public List<User> getAll() {
		DetachedCriteria criteria = DetachedCriteria.forClass(User.class);
		return getHibernateTemplate().findByCriteria(criteria);
	}

	public User getUserById(Long id) {
		return getHibernateTemplate().get(User.class, id);
	}

}
